package com.atguigu.dga.governance.assessor;


import com.atguigu.dga.governance.bean.AssessParam;
import com.atguigu.dga.governance.bean.GovernanceAssessDetail;
import com.atguigu.dga.meta.bean.TableMetaInfoExtra;
import org.springframework.stereotype.Component;

import java.math.BigDecimal;

@Component("HAS_BUSI_OWNER")
public class HasBusiOwnerAssessor extends Assessor{


    @Override
    public void checkProblem(AssessParam assessParam, GovernanceAssessDetail governanceAssessDetail) {
        TableMetaInfoExtra tableMetaInfoExtra = assessParam.getTableMetaInfo().getTableMetaInfoExtra();
        if (tableMetaInfoExtra.getBusiOwnerUserName()==null||tableMetaInfoExtra.getBusiOwnerUserName().trim().length()==0){
            governanceAssessDetail.setAssessScore(BigDecimal.ZERO);
            governanceAssessDetail.setAssessProblem("缺少业务负责人");
            String url = assessParam.getGovernanceMetric().getGovernanceUrl().replace("{tableId}", assessParam.getTableMetaInfo().getId() + "");
            governanceAssessDetail.setGovernanceUrl(url);
        }
    }
}
